package com.sevenStar.healthManagement.mapper;

import com.sevenStar.healthManagement.entity.User;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public interface UserMapper {
	@Insert("insert into user(id,gender,id_number,name,phone,password) values (#{id},#{gender},#{idNumber},#{name},#{phone},#{password})")
	int insertUser(User user);

	@Select("select * from user where phone = #{phone} and password = #{password}")
	User selectOne(User user);

	@Select("select count(*) from user where phone = #{phone} or id_number = #{idNumber}")
	int selectByPhoneOrIdNumber(User user);

	@Results({
			@Result(column = "id_number", property = "idNumber")
	})
	@Select("select * from user")
	List<User> selectAll();
	@Delete("delete from user where id = #{id}")
	int deleteUserById(String id);

}
